package cn.codeforfun.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.camunda.bpm.engine.task.Task;

import java.util.Date;

/**
 * @author wangbin
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TaskInstanceVO {
    private String id;
    private String name;
    private String description;
    private String formKey;
    private String processInstanceId;
    private String processDefinitionId;
    private Date createTime;
    private Date dueDate;
    private Date followUpDate;

    public static TaskInstanceVO from(Task task) {
        TaskInstanceVO target = new TaskInstanceVO();
        target.setId(task.getId());
        target.setName(task.getName());
        target.setDescription(task.getDescription());
        target.setFormKey(task.getFormKey());
        target.setProcessInstanceId(task.getProcessInstanceId());
        target.setProcessDefinitionId(task.getProcessDefinitionId());
        target.setCreateTime(task.getCreateTime());
        target.setDueDate(task.getDueDate());
        target.setFollowUpDate(task.getFollowUpDate());
        return target;
    }
}
